The present invention relates generally to computer programming, and in particular, to searching source code stored on the storage device.
In an integrated development environment (IDE), a programmer needs to search for code artefacts such as definitions of functions or variables and references to functions or variables. The search may be needed because the programmer wants to check the implementation of the function or wants to rename the function. The traditional way to perform such a search is to use a plain text search. For instance, if a user needs to find the definition of a function called validateOfficialId( ) they would perform a text search in all source code files for the text “validateOfficialId”, manually browse the search results and identify the implementation of the function and the various calls to the function. To go to a specific call to the function, the programmer needs to open the file that contains that call and then to show the piece of code that calls the function, the programmer needs to perform another text search within the opened file and needs to repeat the file search multiple times within the file to ensure that all occurrences of the function are covered within the file. Some editors do not show the line number/column number of the cursor and this makes the search even more difficult. Some text search capabilities in files just open the file that has the string that is searched for, without moving the cursor to that string in the file. This makes searching files even more difficult.
To overcome some of these difficulties associated with manual code searching, some editors provide a more advanced search capability in which the user can right-click on a code artefact (for example a function name) and choose from browse definition, which opens the definition of the artefact and find references, which opens a list of references to this artefact. There are at least three limitations to the search capability described above in that it is not available out of the box for some programming languages (or IDEs), even if the capability were available, it is not a customizable search capability that can meet the user's specific needs and requirements and coding is needed to support a new programming language.
Solutions, such as that described in U.S. Patent Publication No. 2010/0169871, entitled “Structured Search in Source Code”, propose a solution to enhance searching source code. However, the focus of this type of solution is on natural language for searching the code without providing a pluggable, customizable search capability. Furthermore, new code is still required to support a new programming language.